﻿using System;
using System.IO;
using System.Linq;

namespace ConsoleFileExplorer
{
    public class Program
    {
        public static void Main(string[] args)
        {
#if !DEBUG
            if(args == null || args.Length == 0)
                return;
#endif
#if DEBUG
            if(args == null || args.Length == 0)
            {
                var directory = new DirectoryInfo(Environment.CurrentDirectory);
                args = directory.GetDirectories().Cast<FileSystemInfo>()
                                .Concat(directory.GetFiles())
                                .Select(f => f.FullName)
                                .ToArray();
            }
#endif

            args.Select(CreateInfo).Where(i => i.Exists).Foreach(Check);

#if DEBUG
            Console.ReadLine();
#endif
        }

        private static void Check(FileSystemInfo Info)
        {
            Console.WriteLine("-----------------------------------------------------");
            Console.WriteLine(Info.Name);
            Info.GetNTFSStreamInfos().Foreach(info => Console.WriteLine("\t{0}:{1}b", info.Name, info.Size));
            //Console.WriteLine();
        }

        private static FileSystemInfo CreateInfo(string str)
        {
            return Directory.Exists(str)
                               ? (FileSystemInfo)new DirectoryInfo(str)
                               : File.Exists(str) ? new FileInfo(str) : null;
        }
    }
}
